﻿using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.ExceptionHandling;

namespace NewRetail.Application.Core
{
    public class MyExceptionSubscriber : ExceptionSubscriber, ITransientDependency
    {
        private readonly ILogger logger;
        public MyExceptionSubscriber(ILogger<MyExceptionSubscriber> logger)
        {
            this.logger = logger;
        }

        public async override Task HandleAsync(ExceptionNotificationContext context)
        {
            this.logger.LogException(context.Exception, context.LogLevel);
            await Task.CompletedTask;
        }
    }
}
